package me.ereach.internalback.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.ereach.internalback.viewmodel.VXHSysUser;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface VXHSysUserMapper extends BaseMapper<VXHSysUser> {
    @Select("declare @id int " +
            "declare @retvar int " +
            "exec @retvar = p_xhsysuser_u_close " +
            "   #{username}, " +
            "   @id output " +
            "select * from v_xhsysuser where id = @id")
    VXHSysUser closeVXHSysUser(String username);

    @Select("declare @id int " +
            "declare @retvar int " +
            "exec @retvar = p_xhsysuser_u_open " +
            "   #{username}, " +
            "   @id output " +
            "select * from v_xhsysuser where id = @id")
    VXHSysUser openVXHSysUser(String username);

    @Select("declare @id int " +
            "declare @retvar int " +
            "exec @retvar = p_xhsysuser_i " +
            "   #{username}, " +
            "   #{password}, " +
            "   #{acttype}, " +
            "   @id output " +
            "select * from v_xhsysuser where id = @id")
    VXHSysUser insertVXHSysUser(String username, String password, Byte acttype);

    @Select("declare @id int " +
            "declare @retvar int " +
            "exec @retvar = p_xhsysuser_x_login " +
            "   #{username}, " +
            "   #{password}, " +
            "   @id output " +
            "select * from v_xhsysuser where id = @id")
    VXHSysUser loginVXHSysUser(String username, String password);
}
